<template>
  <a-date-picker
    style="width:100%"
    v-bind="instance"
    v-model="defaultValue"
    @change="handleDateChange"/>
</template>

<script>
// import moment from 'moment'

export default {
  props: {
    instance: Object // 配置
  },
  data() {
    return {
      defaultValue: ''
    }
  },
  watch: {
    instance: {
      handler(nVal) {
        Object.assign(this, { ...nVal }) // 把传入的参数，融合到this中
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    handleDateChange(instance, v) {
      this.$emit('change', v)
    }
    // 禁用当前之前的日期
    // disabledDate(current) {
    //   return current && current < moment().startOf('day')
    // }
  }
}
</script>
